<template>
    <div class="my-wrapper">

        <div class="user-info">
            <div class="info">
                <!-- <img :src="this.userInfo.imgUrl" alt=""> -->
                <img :src="require('images/userPhoto/'+this.userInfo.imgUrl)"/>
                <div class="user-desc">
                    <span>昵称：{{ this.userInfo.nickName }}</span>
                    <span>账号：{{ this.userInfo.tel }}</span>
                    <span>个性签名：{{ this.userInfo.signature }}</span>
                </div>
            </div>
        </div>

        
        <ul class="user-list">
            <li class="user-item" @click="goTo('/userProfile')">
                <span>编辑资料</span>
            </li>
            <li class="user-item" @click="goTo('/accountManagement')">
                <span>修改密码</span>
            </li>
            <li class="user-item" @click="goTo('/about')">
                <span>关于我们</span>
            </li>
        </ul>

        <div class="login-out">
            <button @click="toLoginOut">退出登录</button>
        </div>
    </div>
</template>

<script>
import { mapState,mapMutations } from 'vuex';

export default {
    name: 'MyWrapper',
    data() {
        return {
            user: {
                name: "王乐熙",
                email: "123",
                
            }
        }
    },
    computed: {
        ...mapState(['userInfo'])
    },
    methods: {
        ...mapMutations(['loginOut']),
        toLoginOut() {
            this.loginOut();
            this.$router.push('/');
        },
        goTo(path) {
            this.$router.push(path);
        }
    }
};
</script>

<style lang="scss" scoped>
@import '~styles/mixins.scss';
@import '~styles/variables.scss';

.my-wrapper{
// margin-top: $headerHeight;

    .user-info{
            width: 94%;
            height: 1.2rem;
            margin: .1rem;
            background: linear-gradient(90deg,#faf3f3,$defaultBgColor);
            box-shadow: 0 2px 5px $defaultBgColor;
            border-radius: 6px;
            text-align: left;

            .info{
                position: relative;
                display: flex;
                height: 100%;
                padding: .2rem;
                box-sizing: border-box;

                img{
                    width: .5rem;
                    height: .5rem;
                    border-radius: 50%;
                    margin-top: .16rem;
                }
                .user-desc{
                    @include flex-column;
                    margin-left: .2rem;
                    padding: .1rem 0;
                    line-height: .2rem;
                    font-size: .16rem;
                    color: #fff;
                }
            }
    }

    .user-item{
        @include vh-center;
        height: .5rem;
        background-color: #fff;
        border-bottom: 1px solid #ddd;
        box-sizing: border-box;
    
        span{
            font-size: .18rem;
            color: #000;
        }
    }
    
    .login-out {
        height: .66rem;
        width: 100%;
        padding: .1rem 0;
        box-sizing: border-box;


        button {
            width: 100%;
            height: 100%;
            text-align: center;
            font-size: .2rem;
            color: #d86262;
            background-color: #fff;
            border: 1px solid #fff;
            border-radius: .03rem;
            box-sizing: border-box;
        }
    }
}

</style>
